#include "GeneratorEnvironment.h"
#include "Generator.h"
#include "Trace.h"

namespace tsc
{
namespace common
{

/*******************************************************************************
 *
 * Constructor
 *
 ******************************************************************************/
GeneratorEnvironment::GeneratorEnvironment()
{

} // GeneratorEnvironment::GeneratorEnvironment

/*******************************************************************************
 *
 * Destructor
 *
 ******************************************************************************/
GeneratorEnvironment::~GeneratorEnvironment()
{

} // GeneratorEnvironment::~GeneratorEnvironment

void
GeneratorEnvironment::addToRemoveList(Generator* g)
{
	if(g)
	{
		_removedList.push_back(g);
		TRACE(7, "Adding generatorId=%u, to remove list size=%u",
				g->getGeneratorId(),
				_removedList.size());

	}
}

void
GeneratorEnvironment::deleteRemovedGenerators()
{
	std::list<Generator*>::iterator it = _removedList.begin();
	TRACE(7, "Deleting removed generators, num=%u", _removedList.size());
	while(it != _removedList.end())
	{
		delete *it;
		it = _removedList.erase(it);
	}
}


} // namespace common
} // namespace tsc
